//package org.lib.webvalidation.common;
//
//import java.util.List;
//
//import org.springframework.validation.BindException;
//import org.springframework.validation.BindingResult;
//import org.springframework.validation.ObjectError;
//import org.springframework.web.bind.annotation.ControllerAdvice;
//import org.springframework.web.bind.annotation.ExceptionHandler;
//import org.springframework.web.bind.annotation.ResponseBody;
//
//import lombok.extern.slf4j.Slf4j;
//
///**
// * 全局异常拦截
// * @author ben
// * @date 2021-09-26 13:37:18 CST
// */
//// 方式1：1个注解
////@RestControllerAdvice
//// 方式2：2个注解
//@ControllerAdvice
//@ResponseBody
//@Slf4j
//public class AppExceptionHandler {
//
//	@ExceptionHandler(value = {BindException.class})
//	public String handleRequestValid(BindException be) {
//		log.warn("请求参数异常：be={}, {}", be.getClass(), be.getMessage());
//		
//		BindingResult br = be.getBindingResult();
//		List<ObjectError> oel = br.getAllErrors();
//		StringBuffer sb = new StringBuffer();
//		sb.append("参数错误：");
//		oel.forEach(oe->{
//			sb.append(oe.getDefaultMessage() + ";");
//		});
//		return sb.toString();
//	}
//}
